import request from "../../utils/request";

/**
 * 小程序授权登录
 * @param {String} code weChatCode
 */
export const loginByCode = (weChatCode) => {
  return request({
    url: '/admin/dict',
    data: { weChatCode },
    needToken: false,
    header: {
      'content-type': 'application/x-www-form-urlencoded'
    }
  })
}

/**
 * 获取当前用户信息
 */
export const getUserInfo = () => {
  return request({
    url: '/api/user/current'
  })
}

/**
 * 获取小程序分销吗
 */
export const getMiniProgramCode = () => {
  return request({
    url: '/api/user/invitationQrCode',
    responseType: 'arraybuffer'
  })
}
